// pages/shouye/shouye.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    "hasUserInfo": false,
    "imgs": [
      "https://tse1-mm.cn.bing.net/th/id/R-C.d3b243014b34275dbf67164a86614d95?rik=ahYQeTkRJzl0OA&riu=http%3a%2f%2fwww.guangyuanol.cn%2fuploads%2fallimg%2f191024%2f0003554205-0.png&ehk=bb75fP%2bIf%2fklf6ddJLH5kuhOEFK%2froc%2bSwerJQ6nx2Y%3d&risl=&pid=ImgRaw&r=0",
      "https://tse1-mm.cn.bing.net/th/id/R-C.ebcf942caaad0443518ab54bd12d531f?rik=xy8W5YOuxZXr1g&riu=http%3a%2f%2fi3.sinaimg.cn%2fhs%2f2012%2f0917%2fU6757P944DT20120917144313.jpg&ehk=BuSw0rxuUCQh5m6HhDe5vMnHItPXWTHu2L%2bClmrih20%3d&risl=&pid=ImgRaw&r=0",
      "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.baolilai-hotel.com%2Fdata%2Fattachment%2Fforum%2F201905%2F09%2F114958tz38bm9mfmgggxgr.jpg&refer=http%3A%2F%2Fwww.baolilai-hotel.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1644456330&t=d924c9203cabf133347bf521d2d9f867"
    ]
  },
  auth() {
    wx.getSetting()
      .then(res => {
        //查询如果没有拉取摄像头权限
        if (!res.authSetting['scope.userLocation']) {
          //让用户进行授权
          wx.authorize({
              scope: 'scope.userLocation',
            })
            .then(res => {
              console.log(res);
            })
            .catch((err) => {
              console.log(err);
            })
        }
      })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // wx.getUserProfile({
    //   "lang":"en",
    //   "desc":"小程序想要获取您的头像和昵称来窃取您的银行账户,是否允许?",
    //   success:(res)=>{
    //     console.log(res);
    //   },
    //   fail:((err)=>{
    //     console.log(err);
    //   })
    // })

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  getUserInfo(){
    wx.getUserProfile({
      desc:"小程序需要获取您的",
      lang:"en",
      success:(res)=>{
        console.log(res);
        this.setData({
          hasUserInfo:true
        })
      },
      fail:(err)=>{
        console.log(err);
      }
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})